create database Blogs
go
use Blogs
go
create table Users
(
Id int primary key identity,
Username nvarchar(6) not null unique,
Password nvarchar(80) not null, 
IsActived bit not null default(1),
IsDeleted bit not null default(0),
CreateTime smalldatetime not null default(getdate()),
UpdateTime  smalldatetime not null default(getdate()),
Remarks varchar(800) null
)

create table Brands(
Id int primary key identity(1,1),
BrandName varchar(80) not null,
Describe varchar(800) null,
IsActived bit not null default(1),
IsDeleted bit not null default(0),
CreateTime smalldatetime not null default(getdate()),
UpdateTime  smalldatetime not null default(getdate()),
Remarks varchar(800) null
)

create table Products
(
Id int primary key identity,
ProductsName nvarchar(80) not null,
BrandId int  foreign key(BrandId) references Users(id),
Describe varchar(800) null,
IsActived bit not null default(1),
IsDeleted bit not null default(0),
CreateTime smalldatetime not null default(getdate()),
UpdateTime  smalldatetime not null default(getdate()),
Remarks varchar(800) null
)

insert into Users(Username,Password)values('amdin','123456')
insert into Users(Username,Password)values('SunBoy','010927')

insert into Brands(BrandName,Describe)values('iPhone','一款美国苹果公司研发的智能手机系列，搭载其研发的iOS操作系统')
insert into Brands(BrandName,Describe)values('小米','小米为发烧而生')

insert into Products(ProductsName,BrandId,Describe)values('Iphone12Pro',1,'拥有5G速度、iPhone迄今最快的芯片 A14 仿生')
insert into Products(ProductsName,BrandId,Describe)values('小米10至尊纪念版',2,'120X超远变焦,骁龙865旗舰处理器、双模5G,你值得拥有')
insert into Products(ProductsName,BrandId,Describe)values('小米MIX Alpha',2,'5G环绕屏概念手机，超1亿像素！')